﻿using OMG.Fill.Mulberry.Model.Ent;
using OMG.Fill.Mulberry.Service;
using ProjectShare;
using System.Collections.Generic;
using System.Web.Http;
namespace OMG.Fill.Mulberry.Model.UI.Controllers
{
    public class RoleController : ApiController
    {
        RoleServices roleServices = new RoleServices();
        
        //[ApiActionAuthorize("获取角色表T_Role分页列表对象操作")]
        //[ApiActionException]
        public Pager<List<RoleModel>> PostPageList(RoleQuery query)
        {
            return roleServices.GetPageList(query);
        }
        //[ApiActionAuthorize("新增角色表T_Role指定对象操作")]
        //[ApiActionException]
        public ResResult<int> Post(RoleEntity model) {
            return roleServices.AddInfo(model);
        }
        //[ApiActionAuthorize("修改角色表T_Role指定对象操作")]
        //[ApiActionException]
        public ResResult<int> Put(RoleEntity model)
        {
            return roleServices.UpdateInfo(model);
        }
        //[ApiActionAuthorize("删除角色表T_Role指定对象操作")]
        //[ApiActionException]
        public ResResult<int> Delete(string id)
        {
            return roleServices.DeleteInfo(id);
        }
        //[ApiActionAuthorize("获取角色表T_Role指定对象操作")]
        //[ApiActionException]
        public ResResult<RoleEntity> Get(string id)
        {
            return roleServices.GetModel(id);
        }

        /// <summary>
        ///根据角色获取菜单树
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public ResResult<List<MenuTree>> GetMRTreeList(string id)
        {
            return roleServices.getMenuTreeList(id);
        }
    }
}